package com.sunny.hp.common.view;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.sunny.hp.common.servlet.ModelAndNCOMZView;

/**
 * @version : 2013. 11. 13.
 * @author : 배민식
 * @분류 : 
 * BEMS2.1 / package com.ntels.bems.sample;
 */

@Controller
@RequestMapping("/excel")
public class ExcelController {


	/**
	 * HIGH SAMPLE SAMPLE
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/excelDown.do")
	public ModelAndNCOMZView samplebutton(HttpServletRequest request, HttpServletResponse response) throws Exception {
		ExcelBaseInfo info = new ExcelBaseInfo();
		info.setSearchConditionRow(2);
		info.setTitleName("TITME");
		info.setDataFirstRow(6);
		info.setTitleRow(1);
		
		LinkedHashMap<String, String> sConditionMap = new LinkedHashMap<String, String>();
		sConditionMap.put("SSSS1", "dDDDD1");
		sConditionMap.put("SSSS2", "dDDDD2");
		
		LinkedHashMap<String, String> data1 = new LinkedHashMap<String, String>();
		data1.put("SSSS1", "dDDDD1");
		data1.put("SSSS2", "dDDDD2");
		data1.put("SSSS3", "dDDDD3");
		
		LinkedHashMap<String, String> data2 = new LinkedHashMap<String, String>();
		data2.put("2SSSS1", "2dDDDD1");
		data2.put("2SSSS2", "2dDDDD2");
		data2.put("2SSSS3", "2dDDDD3");
		
		List<LinkedHashMap> dataList = new ArrayList<LinkedHashMap>();
		dataList.add(data1);
		dataList.add(data2);
		
		
		info.setsConditionMap(sConditionMap);
		info.setDataList(dataList);
		
		
		
		HashMap model = new HashMap();
		LinkedHashMap<String, ExcelBaseInfo> excelBaseInfoMap = new LinkedHashMap<String, ExcelBaseInfo>();
		excelBaseInfoMap.put("test_1", info);
		model.put("BASE_INFO", excelBaseInfoMap);
		model.put("FILE_NAME", "FILE_NAME1234567890");

		return new ModelAndNCOMZView(request, new ExcelFormView(), model);
	}

}
